#include "data_struct.h"
   oal_uint8 stream_entry::push_stream(data_struct *queue_handle)//把接收的数据全部推完
    {
        if(meta_pass)
        {
            oal_int32 temp_len = (can_read_index  - read_index + CACHE_BUFF_LEN)%CACHE_BUFF_LEN;
            if( temp_len > 0 )
            {
                list<oal_int32>::iterator it = user_list->begin();
                oal_int32 userid;
                oal_int32 user_sock_fd;
                user *user_table =  queue_handle->user_head;
               
                while(it != user_list->end())
                {
                    printf("1111\n");
                    userid = *it;
                    user_sock_fd = user_table[userid].socket_id;
                    printf("sendto  user id  [%d] , meta_data [%p] meta_len [%d]\n",user_sock_fd,meta_data,meta_len);
                    if(user_table[userid].is_new)
                    {
                       write2user(user_sock_fd,meta_data,meta_len);//需要先填充http头
                       user_table[userid].is_new = false;
                    }
                    printf("2222,read_index [%d] ,temp_len [%d]\n",read_index,temp_len);
                    if(write2user(user_sock_fd,cache_buff + read_index,temp_len) < 0)
                    {
                        printf("the user close \n");
                        pthread_spin_lock(&userlist_spinlock);
                        user_list->remove(userid);
                        pthread_spin_unlock(&userlist_spinlock);
                        queue_handle->free_user_id(userid);
                    }
                    printf("333\n");
                    it++;
                }
                read_index = (read_index + temp_len)%CACHE_BUFF_LEN;
            }
        }
        if(read_index == write_index && is_close == true)//有待考察
        {
            list<oal_int32>::iterator it = user_list->begin();
            while(it != user_list->end())
            {
                queue_handle->free_user_id(*it);
                it++;
            }
            printf("put stream end!!,the meta len [%d]\n",meta_len);
            return -1;
        }
        else
        {
            return 0;
        }
    }